﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.3.61    催收信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_COL_MAIN: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_COL_MAIN()
		{}
		#region Model
		private long _id;
		private long _loanid;
		private long _proid;
		private long _conid;
		private string _loanno;
		private string _custname;
		private string _custno;
		private string _productname;
		private long _productid;
		private int _isunworkcol;
		private Nullable<DateTime> _lastcoldate;
		private Nullable<DateTime> _nextdate;
		private string _importance;
		private Nullable<DateTime> _promisedate;
		private int _status;
		private string _collevel;
		private string _colby;
		private long _colbyid;
		/// <summary>
		/// 记录ID唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 放款记录IDTb_Loan_Main.ID
		/// </summary>
		[DataMember]
		public long LOANID
		{
			get{return _loanid;}
			set{
				if ( _loanid!= value)
				{
					 _loanid = value;
					OnPropertyChanged("LOANID");
				}
			}
		}
		/// <summary>
		/// 立项申请记录ID
		/// </summary>
		[DataMember]
		public long PROID
		{
			get{return _proid;}
			set{
				if ( _proid!= value)
				{
					 _proid = value;
					OnPropertyChanged("PROID");
				}
			}
		}
		/// <summary>
		/// 合同记录ID
		/// </summary>
		[DataMember]
		public long CONID
		{
			get{return _conid;}
			set{
				if ( _conid!= value)
				{
					 _conid = value;
					OnPropertyChanged("CONID");
				}
			}
		}
		/// <summary>
		/// 贷款号
		/// </summary>
		[DataMember]
		public string LOANNO
		{
			get{return _loanno;}
			set{
				if ( _loanno!= value)
				{
					 _loanno = value;
					OnPropertyChanged("LOANNO");
				}
			}
		}
		/// <summary>
		/// 客户名称
		/// </summary>
		[DataMember]
		public string CUSTNAME
		{
			get{return _custname;}
			set{
				if ( _custname!= value)
				{
					 _custname = value;
					OnPropertyChanged("CUSTNAME");
				}
			}
		}
		/// <summary>
		/// 证件号码
		/// </summary>
		[DataMember]
		public string CUSTNO
		{
			get{return _custno;}
			set{
				if ( _custno!= value)
				{
					 _custno = value;
					OnPropertyChanged("CUSTNO");
				}
			}
		}
		/// <summary>
		/// 贷款产品
		/// </summary>
		[DataMember]
		public string PRODUCTNAME
		{
			get{return _productname;}
			set{
				if ( _productname!= value)
				{
					 _productname = value;
					OnPropertyChanged("PRODUCTNAME");
				}
			}
		}
		/// <summary>
		/// 贷款产品记录ID
		/// </summary>
		[DataMember]
		public long PRODUCTID
		{
			get{return _productid;}
			set{
				if ( _productid!= value)
				{
					 _productid = value;
					OnPropertyChanged("PRODUCTID");
				}
			}
		}
		/// <summary>
		/// 是否非工作日催收0否，1是
		/// </summary>
		[DataMember]
		public int ISUNWORKCOL
		{
			get{return _isunworkcol;}
			set{
				if ( _isunworkcol!= value)
				{
					 _isunworkcol = value;
					OnPropertyChanged("ISUNWORKCOL");
				}
			}
		}
		/// <summary>
		/// 最后催收日期
		/// </summary>
		[DataMember]
		public Nullable<DateTime> LASTCOLDATE
		{
			get{return _lastcoldate;}
			set{
				if ( _lastcoldate!= value)
				{
					 _lastcoldate = value;
					OnPropertyChanged("LASTCOLDATE");
				}
			}
		}
		/// <summary>
		/// 下次催收日期
		/// </summary>
		[DataMember]
		public Nullable<DateTime> NEXTDATE
		{
			get{return _nextdate;}
			set{
				if ( _nextdate!= value)
				{
					 _nextdate = value;
					OnPropertyChanged("NEXTDATE");
				}
			}
		}
		/// <summary>
		/// 重要性
		/// </summary>
		[DataMember]
		public string IMPORTANCE
		{
			get{return _importance;}
			set{
				if ( _importance!= value)
				{
					 _importance = value;
					OnPropertyChanged("IMPORTANCE");
				}
			}
		}
		/// <summary>
		/// 承诺还款日期
		/// </summary>
		[DataMember]
		public Nullable<DateTime> PROMISEDATE
		{
			get{return _promisedate;}
			set{
				if ( _promisedate!= value)
				{
					 _promisedate = value;
					OnPropertyChanged("PROMISEDATE");
				}
			}
		}
		/// <summary>
		/// 状态
        ///1待催收
        ///2催收中
        ///3转出中
        ///5催收成功
		/// </summary>
		[DataMember]
		public int STATUS
		{
			get{return _status;}
			set{
				if ( _status!= value)
				{
					 _status = value;
					OnPropertyChanged("STATUS");
				}
			}
		}
		/// <summary>
		/// 催收级别分M1,M2,M3
		/// </summary>
		[DataMember]
		public string COLLEVEL
		{
			get{return _collevel;}
			set{
				if ( _collevel!= value)
				{
					 _collevel = value;
					OnPropertyChanged("COLLEVEL");
				}
			}
		}
		/// <summary>
		/// 催收人
		/// </summary>
		[DataMember]
		public string COLBY
		{
			get{return _colby;}
			set{
				if ( _colby!= value)
				{
					 _colby = value;
					OnPropertyChanged("COLBY");
				}
			}
		}
		/// <summary>
		/// 催收人记录ID
		/// </summary>
		[DataMember]
		public long COLBYID
		{
			get{return _colbyid;}
			set{
				if ( _colbyid!= value)
				{
					 _colbyid = value;
					OnPropertyChanged("COLBYID");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

